package com.litong.spring.mvc.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

public class UserController implements Controller {

  @Override
  public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) {
    // 封装数据,设置视图
    ModelAndView mv = new ModelAndView();
    // 封装数据,页面回现
    mv.addObject("hello", "Hello SpringMVC");
    // 设置视图,视图解析器解析该视图
    mv.setViewName("hello");
    return mv;
  }
}
